package test3.file;

import org.junit.Test;
import test3.bean.Admini;
import test3.bean.Employee;

import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class TestFileModel {

    private FileModel model=new FileModel();

    @Test
    public void testCreate() throws IOException {
        model.outputAllEmployee(new HashMap<>());
    }

    @Test
    public void testGetTimeStr(){
 //       System.out.println(model.getThisTimeStr());
    }

    @Test
    public void testAfterDelete(){
        model.afterDeleteOrUpdate(new Employee(1,"lin",0,19),FileOpreation.DELETE);
    }

    @Test
    public void testSaveAdminis(){

        HashMap<String,String> adminis=new HashMap<String,String>(){{
            put("10838","135");
            put("15978","3254");
            put("154a2","12487");
        }};

        model.saveAdministrators(adminis);
    }

    @Test
    public void testGetAllAdminis(){
        System.out.println(model.getAdministrators());
    }

    @Test
    public void testOutPut() throws IOException {
        Map<Integer,Employee>employeeMap=new HashMap<>(){{
            put(1,new Employee(1,"lin",0,19));
            put(2,new Employee(2,"lin",0,19));
            put(3,new Employee(3,"lin",0,19));
        }};

        model.outputAllEmployee(employeeMap);
    }
}
